package com.itheima.controller;

import com.itheima.order.pojo.OrderInfo;
import com.itheima.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @Value("${server.port}")
    private int port;

    /**
     * 查询订单信息
     */
    @GetMapping(value = "/{id}")
    public OrderInfo one(@PathVariable(value = "id") Long id) {
        System.out.println("server.port" + port);
        return orderService.findById(id);
    }

    @GetMapping(value = "getHeader")
    public String getHeader(@RequestHeader(value = "Heima")String headeValue) {
        return headeValue;
    }
}

